<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<body>


	<ui:composition template="/Template/TemplateAdmin.xhtml">
		<ui:define name="AdminContent">
			<p:panelGrid columns="2">
				<f:facet name="header">Employee</f:facet>
				<h:outputLabel value="Code" />
				<h:outputLabel value="#{unionServiceView.employee.codfisc}" />
				<h:outputLabel value="Name" />
				<h:outputLabel value="#{unionServiceView.employee.name}" />
				<h:outputLabel value="Surname" />
				<h:outputLabel value="#{unionServiceView.employee.surname}" />
				<h:outputLabel value="Union Tax" />
				<h:outputLabel value="#{unionServiceView.union.union_tax}" />
			</p:panelGrid>
			<br />
			<h:form>

				<p:panelGrid>
					<p:row>
						<p:column>
							<p:outputLabel for="date" value="Date:" />
						</p:column>
						<p:column>
							<p:calendar id="date" value="#{unionServiceView.uniondue.date}"
								required="true" />
							<p:message for="date" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<p:outputLabel value="Extra tax" />
						</p:column>
						<p:column>
							<p:inputText value="#{unionServiceView.uniondue.amount}" />
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="2">
							<p:commandButton
								action="#{unionServiceView.AddNewUnionService()}"
								value="New Union Service" update=":uniontable" ajax="true">
								<f:param name="SendEmployee"
									value="#{unionServiceView.employee.id}"></f:param>
							</p:commandButton>
						</p:column>
					</p:row>
				</p:panelGrid>
			</h:form>
			<br />
			<p:dataTable var="unionDue" id="uniontable" 
				value="#{unionServiceView.listUnionDueEmployee}">
				<f:facet name="header">List Of Extra Union Tax</f:facet>
				<p:column headerText="Data">
					<h:outputText value="#{unionDue.date}">
						<f:convertDateTime pattern="dd-MM-yyyy" timeZone="CET" />
					</h:outputText>
				</p:column>
				<p:column headerText="Amount">
					<h:outputText value="#{unionDue.amount}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:form>
							<p:commandButton value="Delete"
								action="#{unionServiceView.DeleteUnionDues()}" onclick="history.go(0)">
								<f:param name="SendEmployee"
									value="#{unionServiceView.employee.id}"></f:param>
							</p:commandButton>
						</h:form>
					</f:facet>
					<p:selectBooleanCheckbox>
						<p:ajax listener="#{unionServiceView.addDeleteUnion(unionDue)}" />
					</p:selectBooleanCheckbox>
				</p:column>
			</p:dataTable>

		</ui:define>
	</ui:composition>
</body>
</html>
